#ifndef __PUBLIC_DEFILE_H__
#define __PUBLIC_DEFILE_H__

#include <string>

enum ACT_ID
{
    ACT_CHARGE   = 1,   //充值
    ACT_REFUND   = 2,   //退款
    ACT_WITHDRAW = 3,   //提现
    ACT_WITHDRAW_REJECT = 4,   //提现拒绝
};

enum ITEM_ID
{
    ITEM_DEPOSIT    = 1,
    ITEM_CASH       = 2,
    ITEM_BONUS_FLOW = 3,  //提现流水
    ITEM_BET_FLOW   = 4,   //投注流水
};

enum ERROR_ID
{
    ERR_SUCCESS        = 0,
    ERR_FAILED         = -1,
    ERR_PARAM_INVALID  = -2,
    ERR_AMOUNT_LIMIT   = -3,
    ERR_TIMES_LIMIT    = -4,
    ERR_NO_BANKINFO    = -5,
    ERR_LESS_MONEY     = -6,
    ERR_STATUS_ERROR   = -7,
    ERR_USER_NOT_EXIST = -8,
    ERR_NOT_BIND_MOBILE = -9,
};

enum USER_FORBIT_TYPE
{
    FORBIT_NULL = 0,
    FORBIT_IP = 1,
    FORBIT_BANK = 2,
    FORBIT_DEVICE = 3,
    FORBIT_MOBILE = 4,
};

// const std::string ST_ALLOCATED_UID_LIST("allocated_uid_list");			// 有效用户列表
// const std::string ST_USED_UID_LIST("used_uid_list:");		
const std::string ST_USED_BANK_ACCOUNT_LIST("used_bank_account_list:");		
const std::string S_ALLOCATED_UID_INDEX("allocated_uid_index:");			// uid分配表
//来源场景标记
const std::string USER_SOURCE_DEFAULT("D");
const std::string USER_SOURCE_FB("F");
const std::string USER_SOURCE_SPIN("S");
const std::string USER_SOURCE_AGENT("A");
const std::string USER_SOURCE_MAIL("M");
const std::string USER_SOURCE_GAME("G");
const std::string USER_SOURCE_FISSION("C");         //推金币
const std::string USER_SOURCE_RUMMY1("R");         // rummy赛事1
const std::string USER_SOURCE_RUMMY2("T");         // rummy赛事2
const std::string USER_SOURCE_RUMMY3("U");         // rummy赛事3
const std::string USER_SOURCE_RUMMY4("W");         // rummy赛事4
const std::string USER_SOURCE_RUMMY5("Y");         // rummy赛事5
const std::string USER_SOURCE_SIGN("H"); // 补签

const std::string TH_USER_GAMEINFO("ugame:");		// 用户游戏信息ugame:userid
const std::string TH_USER_VIPINFO("uvip:");           // 用户积分信息 uvip:userid
const std::string TH_USER_BASIC("ubasic:");         // 用户基本信息 ubasic:userid
const std::string TH_USER_SPIN("uspin:");           // 用户转盘信息 uspin:userid
const std::string TH_DAILY_WITHDRAW("daily_withdraw:");   // 每日提现记录
const std::string TH_GAME_RULES_CONFIG("game_rules_config");  //游戏规则配置
const std::string TH_USER_GUIDE("user_guide:");     //用户引导信息

const int RATIO_BASE(10000);  //概率、倍数相关数值统一以10000为基数
const int CURRENCY_BASE(1000);  //货币相关数值统一以1000为基数

const std::string TH_LABEL_CONFIG("label:config:map");

const std::string ST_IP_BLACKLIST("ip:blacklist:set");
const std::string ST_UUID_BLACKLIST("uuid:blacklist:set");
const std::string ST_MOBILE_BLACKLIST("mobile:blacklist:set");
const std::string ST_BANK_BLACKLIST("bank:blacklist:set");

//新手引导场景
const std::string STR_GUIDE_VIP("vip");
const std::string STR_GUIDE_WITHDRAW("withdraw");
const std::string STR_GUIDE_WHEEL("wheel");
const std::string STR_GUIDE_AGENT("agent");
const std::string STR_GUIDE_RANK("rank");

const std::string TH_USER_WALLET("user_wallet_info:");
//用户游戏数据
const std::string TH_USER_GAME_DATA("user_game_data:");
const std::string ST_USER_DATA_UPDATE("user_data_update");  //待落地用户uid


const std::string TH_ROOM_LEVEL_CFG("ccgame:config:roomlevel.json:");  // 游戏等级配置ccgame:config:roomlevel.json:101.json
const std::string TH_GAME_ROOM_CFG("ccgame:config:roomdetail:");  // 游戏配置ccgame:config:roomdetail:101 hash
const std::string TH_GAME_ROOM_RULE_CFG("ccgame:config:gamerule:");  // 游戏规则配置ccgame:config:gamerule:101

const std::string TH_GAME_ROOM_ROBOT_BASE_CFG("ccgame:config:robotbase:");  // 游戏机器人配置 cccgame:config:robot:base:101
const std::string TH_GAME_ROOM_JACKPOT_POOL_CFG("ccgame:config:jackpot:reward_pool:");  // 游戏jackpot奖池配置 ccgame:config:jackpot:reward_pool:102
const std::string TH_GAME_ROOM_JACKPOT_REWARD_CFG("ccgame:config:jackpot:rewardcfg:");  // 游戏jackpot开奖配置 ccgame:config:jackpot:rewardcfg:102
const std::string TH_GAME_ROOM_JACKPOT_CARD_CFG("ccgame:config:jackpot:cardcfg:");  // 游戏jackpot卡片生成配置 ccgame:config:jackpot:cardcfg:102
enum USER_LABEL_GROUP_ID
{
    LABEL_GROUP_DAYS_ACTIVE = 1000,               // 注册后活跃天数
    LABEL_GROUP_RECHARGE_WITHDRAW_DIFF = 2000,            // 充值提现差额
    LABEL_GROUP_AMOUNT_COIN_TOTAL = 3000,          // 当前总余额
    LABEL_GROUP_WITHDRAW = 4000,            // 可提现金额
    LABEL_GROUP_GAME_ROUND = 5000,          // 进入游戏总局
    LABEL_GROUP_GAME_DURATION = 6000,       // 进入游戏总天数（进入游戏对局后的有效局数时长）
    LABEL_GROUP_HALL_DURATION = 7000,       // 大厅在线天数（在大厅的总时长，进入游戏后不计算）
    LABEL_GROUP_TOTAL_BET = 8000,           // 游戏投注总金额
    LABEL_GROUP_TOTAL_WIN = 9000,           // 游戏盈利总额
    LABEL_GROUP_WIN_LOST = 10000,           // 玩家游戏盈亏差额

    LABEL_GROUP_VIP = 11000,                // VIP
    LABEL_GROUP_SPIN_WITHDRAW_TOTAL = 12000,     // 大转盘领取佣金总金额
    LABEL_GROUP_SPIN_INVITE_COUNT = 13000,       // 大转盘邀请人数
    LABEL_GROUP_SPIN_INVITE_TOTAL_RECHARGE = 14000,       // 大转盘被邀请人充值总金额（未实现）

    LABEL_GROUP_AGENT = 15000,          // 代理等级
    LABEL_GROUP_AGENT_ONE = 15001,          // 代理等级-1
    LABEL_GROUP_AGENT_TOW = 15002,          // 代理等级-2
    LABEL_GROUP_AGENT_THREE = 15003,        // 代理等级-3

    LABEL_GROUP_AGENT_TEAM_SIZE = 16000,  // 代理商下属人数
    LABEL_GROUP_AGENT_INVITE_COUNT = 17000,       // 代理邀请人数
    LABEL_GROUP_AGENT_INVITE_RECHARGE = 18000,        // 代理被邀请人充值总金额

    LABEL_GROUP_WITHDRAW_TOTAL = 19000,     // 提现总金额
    LABEL_GROUP_WITHDRAW_TOTAL_TODAY = 20000,     // 当日累计提现总金额
    LABEL_GROUP_WITHDRAW_COUNT = 21000,     // 提现次数
    LABEL_GROUP_RECHARGE_TOTAL = 22000,         // 充值总金额
    LABEL_GROUP_RECHARGE_TOTAL_TODAY = 23000,     // 当日累计充值总金额

    LABEL_GROUP_RECHARGE_COUNT = 24000,     // 充值次数

    LABEL_GROUP_RISK_CONTROL = 25000,     // 风险控制
    LABEL_RISK_CONTROL_IP_LOGIN = 25001,
    LABEL_RISK_CONTROL_IP_WITHDRAW = 25002,
    LABEL_RISK_CONTROL_IP_ACTIVITY = 25003,

    LABEL_GROUP_INVITED_USER = 26000,     // 被邀请用户标签
    LABEL_GROUP_INVITED_USER_LABEL = 26001,     // 被邀请用户标签（未实现）

    LABEL_GROUP_MANUAL = 27000,     // 手动标签

    LABEL_GROUP_COMMERCIAL = 28000,     // 广告用户标签
    LABEL_GROUP_COMMERCIAL_LABEL = 28001,     // 广告用户标签

};

enum GAME_ID_ENUM
{
    GAME_ID_AVIATOR  = 101,
    GAME_ID_ANDARBAHAR = 102,
    GAME_ID_AVIATOR2 = 103,
    GAME_ID_SEVENUP = 104,
};

// key 必须是 const char*,  不能是 std::string
#define json_get_int(root, key, def) \
    ((root).isMember(key) && (root)[key].isInt() ? (root)[key].asInt() : (log_error("error key:%s",key), def))

#define json_get_uint(root, key, def) \
    ((root).isMember(key) && (root)[key].isUInt() ? (root)[key].asUInt() : (log_error("error key:%s",key), def))

#define json_get_int64(root, key, def) \
    ((root).isMember(key) && (root)[key].isInt64() ? (root)[key].asInt64() : (log_error("error key:%s",key), def))

#define json_get_string(root, key, def) \
    ((root).isMember(key) && (root)[key].isString() ? (root)[key].asString() : (log_error("error key:%s",key), def))

#define json_get_array(root, key) \
    ((root).isMember(key) && (root)[key].isArray() && (root)[key].size() > 0 ? (root)[key] : (log_error("error key:%s",key), Json::Value(Json::arrayValue)))



enum ROOM_TAB_ENUM
{
    ROOM_TAB_DEFAULT = 0,  // 默认
    ROOM_TAB_SINGLE = 1,    // 单人模式
};
#endif // __PUBLIC_DEFILE_H__